new() and delete()
Some remarks |
| new returns a pointer to the allocated memory |
| The storage duration of the new object is from the point
| of creation until the operator delete destroys it by |
| deallocating its memory, or until the end of the |
| program. |
| By default, an allocation failure (such as insufficient or |
| fragmented heap memory) results in the predefined |
| exception bad_alloc being thrown. |
| You should use the delete operator to remove all |
| memory which has been allocated by the new operator. |
| Failure to free memory can result in memory leaks. |
| The delete operator offers dynamic storage |
| deallocation, deallocating a memory block allocated by a |
| previous call to new. |